package test.vo;

import java.util.List;

import javax.swing.table.AbstractTableModel;

public class DbTable extends AbstractTableModel {
	private static final long serialVersionUID = 1L;
	public static final String[] nameCN = { "","数据库" , "表名","描述" };
	public static final String[] name = { "NUM", "TABLE_SCHEMA","TABLE_NAME", "TABLE_DESC" };
	public static final int[] colWidth = { 20, 50,200, 150 };
	private List<String[]> data;

	public DbTable() {
	}

	public DbTable(List<String[]> data) {
		this.data = data;
	}

	public List<String[]> getData() {
		return data;
	}

	public void setData(List<String[]> data) {
		this.data = data;
	}

	@Override
	public int getRowCount() {
		return null == data ? 0 : data.size();
	}

	@Override
	public int getColumnCount() {
		return nameCN.length;
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		return null == data ? null : data.get(rowIndex)[columnIndex];
	}

	@Override
	public String getColumnName(int column) {
		return nameCN[column];
	}

	@Override
	public Class<?> getColumnClass(int columnIndex) {
		return String.class;
	}

}
